home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk66 / execute / ex.c < prev    next >
C/C++ Source or Header  |  1995-03-19  |  1KB  |  39 lines

  1. /*** Ex.c ****************************************************************
  2. * @Ram-Rez¡ Public Domain By Adan L. Ramirez II BIX:ramrez 
  3. * Compiler: LATTICE { lc -Lt -m1 -O Ex.c };
  4. * Revision 01.0 89/03/25 02:30:00 @Ram-Rez¡
  5. * Description: Executes a command file that contains commands
  6. * Format: Ex <command-file>
  7. **************************************************************************/
  8.  
  9. #include <libraries/dosextens.h>
  10. #include <stdio.h>
  11.  
  12. main(argc,argv)
  13. int argc;
  14. char *argv[];
  15. {
  16.     struct Process *process,*FindTask();
  17.     struct CommandLineInterface *cli;
  18.         struct FileHandle *input,*Open();
  19.     process = (struct Process *)FindTask(0L);
  20.     cli     = (struct CommandLineInterface *)BADDR(process->pr_CLI);
  21.     if(argc == 1||argc > 2)
  22.       {
  23.         write(fileno(stdout),"Ex <command-file>\n",19);
  24.         exit(0);
  25.       }
  26.     if(input = Open(argv[1], MODE_OLDFILE))
  27.       {
  28.              cli->cli_CurrentInput  = (BPTR)input;
  29.                 exit(1); 
  30.       }
  31.     write(fileno(stdout),"Ex: Cannot Open File\n",22);
  32.     exit(0);
  33.  }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.